<template>
	<view class="bim">
		<iframe :webview-styles="webviewStyles" :update-title="false" class="bim-view" :src="Src"></iframe>
	</view>
</template>
<script>
import { BimConfigu } from '@/api/sample/index';
import {bimUrl} from '../../common/urlConfig.js'
export default {
	data() {
		return {
			BimId: '',
			Src: '',
			marks:[],
			webviewStyles: {
				progress: {
				  color: "#0bbe06"
				}
			  }
		};
	},
	onLoad(params) {
		this.handleBimcx(params.token, params.projectId)
		// this.Src = `http://116.63.169.156:9000/outer/indexView?token=${params.token}&projectId=${params.projectId}`
	},
	onReady() {
	  },
	methods: {
		async handleBimcx(token, projectId) {
			const row = await BimConfigu();
			this.BimId = row.data.path;
			if(!this.BimId.includes("http://")){
				this.Src = `${bimUrl}/outer/indexView?token=${token}&projectId=${projectId}&Bim=${this.BimId}`
			}else{
				this.Src = `${this.BimId}&punctuation=0&${Date.parse(new Date())}`
			}
		}
	}
};
</script>
<style lang="scss" scoped>
.bim {
	width: 100vw;
	height: 100vh;
	background-color: #b6b5b5;
	
	.bim-view {
		width: 100vw;
		height: 100vh;
	}
}
</style>
